package com.loriot.common.maximum_population_year_1854;

/**
 * @Title: pointsThatIntersectWithCars_2848
 * @Package: com.loriot.common
 * @Description:
 * @Author: zzy boy
 * @Date: 2025/10/21 10:36
 * @Version: 0.0.1-alpha
 */

public class Main {
    class Solution1 {
        public int maximumPopulation(int[][] logs) {
            int[] differ = new int[102];
            for(int[] item:logs){
                differ[item[0]-1950] ++;
                differ[item[1]-1950]--;
            }
            int max = 0;
            int year = 0;
            int count = 0;
            for(int i = 0;i < differ.length;i++){
                count+=differ[i];
                if(count>max){
                    max = count;
                    year = i+1950;
                }
            }
            return year;
        }
    }

}
